#pragma once

#include <QThread>
#include <QImage>
#include <QTime>
#include <QMutex>
#include <QQueue>

class MainWindow;


class MyQueue :public QQueue<QImage>
{
public:

    QImage pop();
    void push(QImage img);

private:

    QMutex m_mutex;
};



class CaptureThread : public QThread
{
    Q_OBJECT

public:
    CaptureThread(QObject *parent = nullptr);

    void SetParam(MainWindow* pWnd);
    void SetPicturePath(QString strPath);
    void stop();
    void run();

signals:
    void fpsRate(int nFps);

private:
    MyQueue*        m_queImage;
    QTime           m_tmBeginTime;
    int             m_nStatIndex;
    int             m_nImgIndex;
    MainWindow*     m_pMainWnd;
    bool            m_flag;
    bool            m_refresh;
    QString         m_strPictruePath;
};

